function loadSVGStyle(url,type) {
  if(type == 'js'){
    const sct = document.createElement('script')
    sct.src = window.location.origin+url
    const head = document.getElementsByTagName('head')[0]
    head.appendChild(sct)
    document.body.appendChild(sct)
  }else{
    const sct = document.createElement('link')
    sct.setAttribute("rel", "stylesheet");
    sct.setAttribute("type", "text/css");
    sct.setAttribute("href", window.location.origin+url);
    const head = document.getElementsByTagName('head')[0]
    head.appendChild(sct)
    document.body.appendChild(sct)
  }
}
function axiosLoadIcon() {
  let _this = this;
  axios({
    method: 'get',
    url: '/icon/all',
    params: {
      names:['流程图2','流程图1','流程图','未知图标库','未知图标库2','未知图标库3','未知图标库4','企业知识库图标']
    }
  }).then(function (response) {
    if(response.data && response.data.code == 0) {
      let data  = response.data.data
      let tps = []
      let allList = []
      data.forEach(ele => {
        tps.push(ele.label)
        if(ele.description){
          loadSVGStyle(ele.description,'js');
        }
        if(ele.value){
          loadSVGStyle(ele.value,'css');
        }
        allList = [...allList, ...[...ele.list]]
      });
      localStorage.setItem('jvs-lib', JSON.stringify({
        dataType: typeof (data),
        content: data,
        type: 'session',
        datetime: new Date().getTime()
      }));
      localStorage.setItem('jvs-allType', JSON.stringify({
        dataType: typeof (tps),
        content: tps,
        type: 'session',
        datetime: new Date().getTime()
      }));
      localStorage.setItem('jvs-iconList', JSON.stringify({
        dataType: typeof (allList),
        content: allList,
        type: 'session',
        datetime: new Date().getTime()
      }));
    }
  }).catch(function (error) {
    console.log(error)
  })
}
